Using Euclids Extended Algorithm:
Calculate x and y in Bézout's Identity
using (4,5)
For 2 numbers a and b and divisor d:
ax + by = d
a math | a | b math | b | d math | d | k math | k |
---|---|---|---|---|---|---|---|
Set to 1 | 1 | Set to 0 | 0 | 4 | |||
Set to 0 | 0 | Set to 1 | 1 | 5 | Quotient of 4/5 | 0 | |
1 - (0 x 0) | 1 | 0 - (0 x 1) | 0 | Remainder of 4/5 | 4 | Quotient of 5/4 | 1 |
0 - (1 x 1) | -1 | 1 - (1 x 0) | 1 | Remainder of 5/4 | 1 | Quotient of 4/1 | 4 |
1 - (4 x -1) | 5 | 0 - (4 x 1) | -4 | Remainder of 4/1 | 0 | Quotient of 1/0 | 0 |
a = -1 and b = 1
ax + by = gcd(a,b)
4x + 5y = gcd(4